import requests
# #   发送get请求
# #       方式1：参数在URL中 Keyword
# URL = 'https://search.jd.com/Search?keyword=雨伞&enc=utf-8'
# # http://www.hnxmxit.com
#
header = {'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36'}
# res = requests.get(url=URL,headers=header)
# print(res.text)
# print(res.content.decode('utf-8'))  #解码    content是二进制  进行解码



#       方式2：参数在字典中  (相对常用)
URL = 'https://search.jd.com/Search'
data = {"keyword":"汽车"}
res = requests.get(url=URL,headers=header,params=data)
print(res.content.decode('utf-8'))


